/** CS2340 Spring 2011 Project
 *  Team: 40 Jiggawatt Hard Driver
 *  Suk Hwan Hong
 *  Rhys Saraceni
 *  Travis Cooper
 *  Luke Stubb
 *
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0 
 */

package edu.gatech.jiggawatt.office.model;

import java.io.Serializable;

/**
 * Represents Date
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0 *
 */
public class Date implements Comparable<Date>, Serializable // $codepro.audit.disable declareDefaultConstructors
{
	private int year;
	private int month;
	private int day;	

	/**
	 * Creates Date
	 * @param year
	 * @param month
	 * @param day
	 */
	public Date(int year, int month, int day)
	{
		this.year = year;
		this.month = month;
		this.day = day;
	}
	
	/**
	 * gets year
	 * @return year
	 */
	public int getYear()
	{
		return year;
	}
	
	/**
	 * gets month
	 * @return month
	 */
	public int getMonth()
	{
		return month;
	}
	
	/**
	 * gets day
	 * @return day
	 */
	public int getDay()
	{
		return day;
	}	
	
	/**
	 * sets year
	 * @param year
	 */
	public void setYear(int year)
	{
		this.year = year;
	}
	
	/**
	 * sets month
	 * @param month
	 */
	public void setMonth(int month)
	{
		this.month = month;
	}
	
	/**
	 * sets day
	 * @param day
	 */
	public void setDay(int day)
	{
		this.day = day;
	}
	
	/**
	 * returns string format of date
	 * @return string format of date
	 */
	public String toString()
	{
		return year + "-" + month + "-" + day;
	}
	
	/** compares date
	 * @param date other date to compare
	 * @return 1 if greater, 0 if equals, -1 if less
	 */
	public int compareTo(Date date) 
	{
        if (year == date.getYear() && month == date.getMonth() && day == date.getDay())
        {
        	return 0;
        }
        else if (year < date.getYear())
        {
        	return -1;
        }
        else if (year > date.getYear())
        {
        	return 1;
        }
        else if (month < date.getMonth())
        {
        	return -1;
        }
        else if (month > date.getMonth())
        {
        	return 1;
        }
        else if (day < date.getDay())
        {
        	return -1;
        }
        else
        {
        	return 1;
        }
    }
}
